{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Planning a factory site\n", "## Problem Definition\n", "Dinoco, a multinational firm in the automobile sector, is deciding on whether to build an assembly plant in Brazil or in Mississipi (USA). The cost to build this plant in Brazil is 10 million euros and the cost of building the plant in Mississippi is 20 million. However, if the firm builds the plant in Brazil and local demand drops over the following 5 years, the project will be stopped and the firm will lose 10M€ (and it will still have to build a plant in Mississippi). A priori, Dinoco believes that the probability of demand for cars dropping in Brazil over the following 5 years is 20%. For 1M€, Dinoco can hire a market research firm to analyse demand for cars in Brazil, which will indicate whether demand for cars will drop or not.\n", "The market research firm’s record indicates that his record shows that they are able to predict the occurrence of a drop in demand with a 95% success rate, and 90% when the demand does not drop.\n", "\n", "**a.** Draw the decision tree.\n", "\n", "**b.** Solve the tree and find the best alternative for Dinoco.\n", "\n", "**c.** Calculate the Imperfect Information Value and the Perfect Information Value associated to the market research (demand in Brazil)\n", "\n", "The following diagram shows the decision tree of the problem: \n", "\n", "![Planning a factory site](img/Planning%20a%20factory%20site.PNG)\n", "\n", "The image has been generated using Python, if you want to do it yourself, you can try the following code cell in a Notebook!" ] }, { "cell_type": "code", "metadata": {}, "source": [ "from graphviz import Digraph\n", "# Create Digraph object\n", "din = Digraph(format='png')\n", "din.graph_attr['rankdir'] = 'LR'\n", "\n", "# Add root node\n", "din.node('1', shape='square', style=\"filled\", fillcolor='yellow')\n", "\n", "# First branch nodes\n", "din.node('2', shape='square', style=\"filled\", fillcolor='yellow')\n", "\n", "din.node('3', shape='circle', style='filled', fillcolor='green')\n", "\n", "din.node('4', xlabel='-30', shape='diamond', style='filled', fillcolor='purple')\n", "\n", "din.node('5', xlabel='-10', shape='diamond', style='filled', fillcolor='purple')\n", "\n", "din.node('6', xlabel='-20', shape='diamond', style='filled', fillcolor='purple')\n", "\n", "din.edge('1', '2', 'Without research')\n", "\n", "din.edge('2', '3', 'Build in Brazil')\n", "\n", "din.edge('2', '6', 'Build in Missisipi')\n", "\n", "din.edge('3', '4', 'Demand Drops')\n", "\n", "din.edge('3', '5', 'Demand does not drop')\n", "\n", "din.node('7', shape='circle', style='filled', fillcolor='green')\n", "\n", "din.edge('1', '7', 'With research')\n", "\n", "# Second branch\n", "din.node('8', shape='square', style=\"filled\", fillcolor='yellow')\n", "din.edge('7', '8', 'Predict demand drops')\n", "\n", "# Second branch nodes\n", "din.node('9', shape='circle', style='filled', fillcolor='green')\n", "\n", "din.node('10', xlabel='-30', shape='diamond', style='filled', fillcolor='purple')\n", "\n", "din.node('11', xlabel='-10', shape='diamond', style='filled', fillcolor='purple')\n", "\n", "din.node('12', xlabel='-20', shape='diamond', style='filled', fillcolor='purple')\n", "\n", "\n", "din.edge('8', '9', 'Build in Brazil')\n", "\n", "din.edge('8', '12', 'Build in Missisipi')\n", "\n", "din.edge('9', '10', 'Demand Drops')\n", "\n", "din.edge('9', '11', 'Demand does not drop')\n", "\n", "# Third branch\n", "din.node('13', shape='square', style=\"filled\", fillcolor='yellow')\n", "\n", "din.edge('7', '13', 'Predict demand does not drop')\n", "\n", "# Third branch nodes\n", "din.node('14', shape='circle', style='filled', fillcolor='green')\n", "\n", "din.node('15', xlabel='-30', shape='diamond', style='filled', fillcolor='purple')\n", "\n", "din.node('16', xlabel='-10', shape='diamond', style='filled', fillcolor='purple')\n", "\n", "din.node('17', xlabel='-20', shape='diamond', style='filled', fillcolor='purple')\n", "\n", "\n", "din.edge('13', '14', 'Build in Brazil')\n", "\n", "din.edge('13', '17', 'Build in Missisipi')\n", "\n", "din.edge('14', '15', 'Demand Drops')\n", "\n", "din.edge('14', '16', 'Demand does not drop')\n", "\n", "din" ], "outputs": [], "execution_count": null }, { "cell_type": "markdown", "metadata": {}, "source": [ "The initial (a priori) probabilities are:\n", "\n", "Probability that demand drops: \n", "$P(D_D) = 0.2$\n", "\n", "Probability that demand does not drop:\n", "$P(D_{ND}) = 0.8$\n", "\n", "The conditional probabilities with additional information are:\n", "\n", "- Record of predicted *market drops* events:\n", "\n", "$P(PD_D|D_D) = 0.95$\n", "\n", "$P(PD_D|D_{ND}) = 0.05$\n", "\n", "Record of predicted *market does not drop* events:\n", "\n", "$P(PD_{ND}|D_D) = 0.1$\n", "\n", "$P(PD_{ND}|D_{ND}) = 0.9$\n", "\n", "With these, the probabilities of occurrence of imperfect information are: \n", "\n", "$P(PD_D) = P(D_D)·P(PD_D|D_D)+P(D_{ND})·P(PD_D|D_{ND}) = 0.27$\n", "\n", "$P(PD_{ND}) = P(D_D)·P(PD_{ND}|D_D)+P(D_{ND})·P(PD_{ND}|D_{ND})=0.73$\n", "\n", "Now with these data, we can calculate the posterior probabilities using the Bayes Theorem:\n", "\n", "$P(D_D|PD_D) = \\frac{P(D_D)·P(PD_D|D_D)}{P(PD_D)}=0.7037$\n", "\n", "$P(D_{ND}|PD_D) = \\frac{P(D_{ND})·P(PD_D|D_{ND})}{P(PD_D)}=0.2963$\n", "\n", "$P(D_D|PD_{ND}) = \\frac{P(D_D)·P(PD_{ND}|D_D)}{P(PD_{ND})}=0.0137$\n", "\n", "$P(D_{ND}|PD_{ND}) = \\frac{P(D_{ND})·P(PD_{ND}|D_D)}{P(PD_{ND})}=0.9863$\n", "\n", "Now, entering this information in the graph, we can calculate the values of the different nodes:\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$V_3 = P(D_D)·V_4+P(D_{ND})·V_5 = 0.2·(-30)+0.8·(-10)=-14$\n", "$V_2 = \\max(V_3, V_6) = -14$\n", "\n", "$V_9 = P(D_D|PD_D)·V_{10}+P(D_{ND}|PD_D)·V_{11} = 0.7037·(-30)+0.2963·(-10)=-24.074$\n", "$V_8 = \\max(V_9,V_{12}) = -20$\n", "$V_{14} = P(D_D|PD_{ND})·V_{15}+P(D_{ND}|PD_{ND})·V_{16} = 0.0137·(-30)+0.9863·(-10)=-10.274$\n", "$V_{13} = \\max(V_{14}, V_{17}) = -10.274$\n", "\n", "$V_7 = P(PD_D)·V_9+P(PD_{ND})·V_{13} = -12.9$\n", "\n", "$V_1 = \\max(V_2, V_7-1) = -13.9$\n", "\n", "According to the decision tree, it is recommended to hire the consultant. The expected cost is -13.9M€. If the report predicts a drop in the demand, the best alternative is to build the plant in Missisipi and if the report does not predict a drop, in Brazil.\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The Expected Return with Perfect Information is:\n", "\n", "ERPI = 0.2·(-20)+0.8·(-10) = -12\n", "\n", "And the Perfect Information Value = \n", "\n", "PIV = ERPI - (-13.9) = -12 -- 13.9 = 1.9\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" }, "pycharm": { "stem_cell": { "cell_type": "raw", "source": [], "metadata": { "collapsed": false } } } }, "nbformat": 4, "nbformat_minor": 2 }